home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: April 22, 1997
- // Author: tbaudel
- //
- // Description:
- // Display -> Custom Polygon Setup item
- //
- // Input Arguments:
- // int if 1 show option box
- // if 0 perform command with current values
- // if 2 returns the default settings as a command string
- // Return Value:
- // none
- //
-
- proc setOptionVars (int $forceFactorySettings)
- {
- // Objects Afftected
- //
- if ($forceFactorySettings || !`optionVar -exists displayPolyObjsAffected`)
- optionVar -intValue displayPolyObjsAffected 0;
-
- // Vertices Display
- if ($forceFactorySettings || !`optionVar -exists displayPolyVtxDisp`) {
- optionVar -clearArray displayPolyVtxDisp;
- optionVar -intValue displayPolyVtxDisp 0
- -intValueAppend displayPolyVtxDisp 0;
- }
-
- // Vertices Backculling
- if ($forceFactorySettings || !`optionVar -exists displayPolyVtxBackCull`) {
- optionVar -clearArray displayPolyVtxBackCull;
- optionVar -intValue displayPolyVtxBackCull 1
- -intValueAppend displayPolyVtxBackCull 1;
- }
-
- // Vertex Normals
- //
- if ($forceFactorySettings || !`optionVar -exists displayPolyVertexNormals`) {
- optionVar -clearArray displayPolyVertexNormals;
- optionVar -intValue displayPolyVertexNormals 0
- -intValueAppend displayPolyVertexNormals 0;
- }
-
- // Edge Display
- if ($forceFactorySettings || !`optionVar -exists displayPolyEdgeDisp`) {
- optionVar -clearArray displayPolyEdgeDisp;
- optionVar -intValue displayPolyEdgeDisp 0
- -intValueAppend displayPolyEdgeDisp 0;
- }
-
- // Border Edge Size
- //
- if ($forceFactorySettings || !`optionVar -exists displayPolyBorderEdgeSize`) {
- optionVar -clearArray displayPolyBorderEdgeSize;
- optionVar -floatValue displayPolyBorderEdgeSize 3.0
- -floatValueAppend displayPolyBorderEdgeSize 3.0;
- }
-
- // Border Edge Highlighting
- //
- if ($forceFactorySettings || !`optionVar -exists displayPolyBorderEdgeHilite`) {
- optionVar -clearArray displayPolyBorderEdgeHilite;
- optionVar -intValue displayPolyBorderEdgeHilite 0
- -intValueAppend displayPolyBorderEdgeHilite 0;
- }
-
- // Border Map Highlighting
- //
- if ($forceFactorySettings || !`optionVar -exists displayPolyBorderMapHilite`) {
- optionVar -clearArray displayPolyBorderMapHilite;
- optionVar -intValue displayPolyBorderMapHilite 0
- -intValueAppend displayPolyBorderMapHilite 0;
- }
-
- // UV and Display UV Topology Display
- if ($forceFactorySettings || !`optionVar -exists displayPolyUV`) {
- optionVar -clearArray displayPolyUV;
- optionVar -intValue displayPolyUV 0
- -intValueAppend displayPolyUV 0;
- }
- if ($forceFactorySettings || !`optionVar -exists displayPolyUVTopology`) {
- optionVar -clearArray displayPolyUVTopology;
- optionVar -intValue displayPolyUVTopology 0
- -intValueAppend displayPolyUVTopology 0;
- }
-
- // Normal Size
- //
- if ($forceFactorySettings || !`optionVar -exists displayPolyNormalSize`) {
- optionVar -clearArray displayPolyNormalSize;
- optionVar -floatValue displayPolyNormalSize 0.4
- -floatValueAppend displayPolyNormalSize 0.4;
- }
-
- // Facets Display
- //
- if ($forceFactorySettings || !`optionVar -exists displayPolyFacetCentreDisp`) {
- optionVar -clearArray displayPolyFacetCentreDisp;
- optionVar -intValue displayPolyFacetCentreDisp 0
- -intValueAppend displayPolyFacetCentreDisp 0;
- }
-
- if ($forceFactorySettings || !`optionVar -exists displayPolyFacetNormalDisp`) {
- optionVar -clearArray displayPolyFacetNormalDisp;
- optionVar -intValue displayPolyFacetNormalDisp 0
- -intValueAppend displayPolyFacetNormalDisp 0;
- }
-
- if ($forceFactorySettings || !`optionVar -exists displayPolyFacetTrngleDisp`) {
- optionVar -clearArray displayPolyFacetTrngleDisp;
- optionVar -intValue displayPolyFacetTrngleDisp 0
- -intValueAppend displayPolyFacetTrngleDisp 0;
- }
-
- if ($forceFactorySettings || !`optionVar -exists displayPolyFacetWarpDisp`) {
- optionVar -clearArray displayPolyFacetWarpDisp;
- optionVar -intValue displayPolyFacetWarpDisp 0
- -intValueAppend displayPolyFacetWarpDisp 0;
- }
-
- if ($forceFactorySettings || !`optionVar -exists displayPolyNumVertex`) {
- optionVar -clearArray displayPolyNumVertex;
- optionVar -intValue displayPolyNumVertex 0
- -intValueAppend displayPolyNumVertex 0;
- }
- if ($forceFactorySettings || !`optionVar -exists displayPolyNumEdge`) {
- optionVar -clearArray displayPolyNumEdge;
- optionVar -intValue displayPolyNumEdge 0
- -intValueAppend displayPolyNumEdge 0;
- }
- if ($forceFactorySettings || !`optionVar -exists displayPolyNumFacet`) {
- optionVar -clearArray displayPolyNumFacet;
- optionVar -intValue displayPolyNumFacet 0
- -intValueAppend displayPolyNumFacet 0;
- }
- if ($forceFactorySettings || !`optionVar -exists displayPolyNumUv`) {
- optionVar -clearArray displayPolyNumUv;
- optionVar -intValue displayPolyNumUv 0
- -intValueAppend displayPolyNumUv 0;
- }
-
- // Backface Culling
- //
- if ($forceFactorySettings || !`optionVar -exists displayPolyBackFaceCull`) {
- optionVar -clearArray displayPolyBackFaceCull;
- optionVar -intValue displayPolyBackFaceCull 0
- -intValueAppend displayPolyBackFaceCull 0;
- }
-
- // Colors
- //
- if ($forceFactorySettings || !`optionVar -exists colorShadedDisplay`) {
- optionVar -clearArray colorShadedDisplay;
- optionVar -intValue colorShadedDisplay 0
- -intValueAppend colorShadedDisplay 0;
- }
-
- if ($forceFactorySettings || !`optionVar -exists colorMaterialChannel`) {
- optionVar -clearArray colorMaterialChannel;
- optionVar -intValue colorMaterialChannel 3 // diffuse
- -intValueAppend colorMaterialChannel 3;
- }
- }
-
- global proc polysDisplayUpdateCulling (string $parent)
- {
- setParent $parent;
-
- int $backfaceCulling = `optionMenuGrp -query -select backfaceCullPopup`;
- checkBoxGrp -edit -enable3 ($backfaceCulling != 1) polyVerticesDisplayCheck;
- }
-
- global proc polysDisplaySetupSetup (string $parent, int $forceFactorySettings)
- {
- // Retrieve the option settings
- //
- setOptionVars ($forceFactorySettings);
- setParent $parent;
-
- int $o = `optionVar -q displayPolyObjsAffected`;
-
- radioButtonGrp -e -sl ($o + 1) polyObjsAffectedRadio;
-
- int $vals[3]; int $vals2[3]; int $vals3[3]; int $vals4[3]; int $val;
- float $fvals[3]; float $fvals2[3];
- string $sval;
-
- $vals=`optionVar -q displayPolyVtxDisp`;
- checkBoxGrp -e -v1 $vals[$o] polyVerticesDisplayCheck;
-
- $vals=`optionVar -q displayPolyVtxBackCull`;
- checkBoxGrp -e -v3 $vals[$o] polyVerticesDisplayCheck;
-
- $vals=`optionVar -q displayPolyVertexNormals`;
- checkBoxGrp -e -v2 $vals[$o] polyVerticesDisplayCheck;
-
- $vals=`optionVar -q displayPolyEdgeDisp`;
- radioButtonGrp -e -sl ($vals[$o] + 1) polyEdgeDisplayRadio;
-
- $fvals=`optionVar -q displayPolyBorderEdgeSize`;
- floatSliderGrp -e -value $fvals[$o] borderEdgeSizeSlider;
-
- // Border Edge Highlighting
- //
- $vals=`optionVar -q displayPolyBorderEdgeHilite`;
- $vals2=`optionVar -q displayPolyBorderMapHilite` ;
- checkBoxGrp -e -v1 $vals[$o] -v2 $vals2[$o] borderEdgeHiliteDisplayCheck;
-
- // UV Topology Display - BK
- $vals=`optionVar -q displayPolyUV`;
- $vals2 =`optionVar -q displayPolyUVTopology`;
- checkBoxGrp -e -v1 $vals[$o] -v2 $vals2[$o] polyUVDisplayCheck;
-
- // NormalSize
- //
- $fvals=`optionVar -q displayPolyNormalSize`;
- floatSliderGrp -e -value $fvals[$o] normalSizeSlider;
-
- // Facets Display
- //
- $vals= `optionVar -q displayPolyFacetCentreDisp` ;
- $vals2=`optionVar -q displayPolyFacetNormalDisp`;
- $vals3=`optionVar -q displayPolyFacetTrngleDisp`;
- $vals4=`optionVar -q displayPolyFacetWarpDisp`;
- checkBoxGrp -e -v1 $vals[$o] -v2 $vals2[$o] -v3 $vals3[$o] -v4 $vals4[$o] polyFacetDisplayCheck;
-
- // Item numbers Display
- //
- $vals= `optionVar -q displayPolyNumVertex` ;
- $vals2=`optionVar -q displayPolyNumEdge`;
- $vals3=`optionVar -q displayPolyNumFacet`;
- $vals4=`optionVar -q displayPolyNumUv`;
- checkBoxGrp -e -v1 $vals[$o] -v2 $vals2[$o] -v3 $vals3[$o] -v4 $vals4[$o] polyItemDisplayCheck;
-
- // Backface Culling
- //
- $vals=`optionVar -q displayPolyBackFaceCull`;
- optionMenuGrp -e -sl ($vals[$o] + 1) backfaceCullPopup;
-
- // Colors
- $vals = `optionVar -q colorShadedDisplay`;
- checkBoxGrp -e -v1 $vals[$o] colorShadedDisplayCheck;
-
- $vals = `optionVar -q colorMaterialChannel`;
- optionMenuGrp -e -sl ($vals[$o]+1) colorMaterialPopup;
-
- // Update the culling settings
- //
- polysDisplayUpdateCulling ($parent);
- }
-
- global proc polysDisplaySetupCallback (string $parent, int $doIt)
- {
- setParent $parent;
-
- // Set the optionVar's from the control values, and then perform the command
- //
- int $o = `radioButtonGrp -q -sl polyObjsAffectedRadio`;
- if ($o < 1) $o=1; $o--;
- optionVar -intValue displayPolyObjsAffected $o;
-
- int $vals[2]; float $fvals[2]; int $val;
-
- $vals=`optionVar -q displayPolyVtxDisp`;
- $vals[$o]=`checkBoxGrp -q -v1 polyVerticesDisplayCheck`;
- optionVar -clearArray displayPolyVtxDisp;
- optionVar -intValue displayPolyVtxDisp $vals[0]
- -intValueAppend displayPolyVtxDisp $vals[1];
-
- $vals=`optionVar -q displayPolyVtxBackCull`;
- $vals[$o]=`checkBoxGrp -q -v3 polyVerticesDisplayCheck`;
- optionVar -clearArray displayPolyVtxBackCull;
- optionVar -intValue displayPolyVtxBackCull $vals[0]
- -intValueAppend displayPolyVtxBackCull $vals[1];
-
- $vals=`optionVar -q displayPolyVertexNormals`;
- $vals[$o]=`checkBoxGrp -q -v2 polyVerticesDisplayCheck`;
- optionVar -clearArray displayPolyVertexNormals;
- optionVar -intValue displayPolyVertexNormals $vals[0]
- -intValueAppend displayPolyVertexNormals $vals[1];
-
- $vals=`optionVar -q displayPolyEdgeDisp`;
- $vals[$o]=`radioButtonGrp -q -sl polyEdgeDisplayRadio` - 1;
- optionVar -clearArray displayPolyEdgeDisp;
- optionVar -intValue displayPolyEdgeDisp $vals[0]
- -intValueAppend displayPolyEdgeDisp $vals[1];
-
- $fvals=`optionVar -q displayPolyBorderEdgeSize`;
- $fvals[$o]=`floatSliderGrp -q -value borderEdgeSizeSlider`;
- optionVar -clearArray displayPolyBorderEdgeSize;
- optionVar -floatValue displayPolyBorderEdgeSize $fvals[0]
- -floatValueAppend displayPolyBorderEdgeSize $fvals[1];
-
- $vals=`optionVar -q displayPolyBorderEdgeHilite`;
- $vals[$o]=`checkBoxGrp -q -v1 borderEdgeHiliteDisplayCheck`;
- optionVar -clearArray displayPolyBorderEdgeHilite;
- optionVar -intValue displayPolyBorderEdgeHilite $vals[0]
- -intValueAppend displayPolyBorderEdgeHilite $vals[1];
-
- $vals=`optionVar -q displayPolyBorderMapHilite`;
- $vals[$o]=`checkBoxGrp -q -v2 borderEdgeHiliteDisplayCheck`;
- optionVar -clearArray displayPolyBorderMapHilite;
- optionVar -intValue displayPolyBorderMapHilite $vals[0]
- -intValueAppend displayPolyBorderMapHilite $vals[1];
-
- $vals=`optionVar -q displayPolyFacetCentreDisp`;
- $vals[$o]=`checkBoxGrp -q -v1 polyFacetDisplayCheck`;
- optionVar -clearArray displayPolyFacetCentreDisp;
- optionVar -intValue displayPolyFacetCentreDisp $vals[0]
- -intValueAppend displayPolyFacetCentreDisp $vals[1];
-
- $vals=`optionVar -q displayPolyFacetNormalDisp`;
- $vals[$o]=`checkBoxGrp -q -v2 polyFacetDisplayCheck`;
- optionVar -clearArray displayPolyFacetNormalDisp;
- optionVar -intValue displayPolyFacetNormalDisp $vals[0]
- -intValueAppend displayPolyFacetNormalDisp $vals[1];
-
- $vals=`optionVar -q displayPolyFacetTrngleDisp`;
- $vals[$o]=`checkBoxGrp -q -v3 polyFacetDisplayCheck`;
- optionVar -clearArray displayPolyFacetTrngleDisp;
- optionVar -intValue displayPolyFacetTrngleDisp $vals[0]
- -intValueAppend displayPolyFacetTrngleDisp $vals[1];
-
- $vals=`optionVar -q displayPolyFacetWarpDisp`;
- $vals[$o]=`checkBoxGrp -q -v4 polyFacetDisplayCheck`;
- optionVar -clearArray displayPolyFacetWarpDisp;
- optionVar -intValue displayPolyFacetWarpDisp $vals[0]
- -intValueAppend displayPolyFacetWarpDisp $vals[1];
-
- $vals=`optionVar -q displayPolyNumVertex`;
- $vals[$o]=`checkBoxGrp -q -v1 polyItemDisplayCheck`;
- optionVar -clearArray displayPolyNumVertex;
- optionVar -intValue displayPolyNumVertex $vals[0]
- -intValueAppend displayPolyNumVertex $vals[1];
- $vals=`optionVar -q displayPolyNumEdge`;
- $vals[$o]=`checkBoxGrp -q -v2 polyItemDisplayCheck`;
- optionVar -clearArray displayPolyNumEdge;
- optionVar -intValue displayPolyNumEdge $vals[0]
- -intValueAppend displayPolyNumEdge $vals[1];
- $vals=`optionVar -q displayPolyNumFacet`;
- $vals[$o]=`checkBoxGrp -q -v3 polyItemDisplayCheck`;
- optionVar -clearArray displayPolyNumFacet;
- optionVar -intValue displayPolyNumFacet $vals[0]
- -intValueAppend displayPolyNumFacet $vals[1];
- $vals=`optionVar -q displayPolyNumUv`;
- $vals[$o]=`checkBoxGrp -q -v4 polyItemDisplayCheck`;
- optionVar -clearArray displayPolyNumUv;
- optionVar -intValue displayPolyNumUv $vals[0]
- -intValueAppend displayPolyNumUv $vals[1];
-
- $fvals=`optionVar -q displayPolyNormalSize`;
- $fvals[$o]=`floatSliderGrp -q -value normalSizeSlider`;
- optionVar -clearArray displayPolyNormalSize;
- optionVar -floatValue displayPolyNormalSize $fvals[0]
- -floatValueAppend displayPolyNormalSize $fvals[1];
-
- // UV and UV Topology
- $vals=`optionVar -q displayPolyUV`;
- $vals[$o]=`checkBoxGrp -q -v1 polyUVDisplayCheck`;
- optionVar -clearArray displayPolyUV;
- optionVar -intValue displayPolyUV $vals[0]
- -intValueAppend displayPolyUV $vals[1];
- //
- $vals=`optionVar -q displayPolyUVTopology`;
- $vals[$o]=`checkBoxGrp -q -v2 polyUVDisplayCheck`;
- optionVar -clearArray displayPolyUVTopology;
- optionVar -intValue displayPolyUVTopology $vals[0]
- -intValueAppend displayPolyUVTopology $vals[1];
-
- // Colors
- $vals = `optionVar -q colorShadedDisplay`;
- $vals[$o] = `checkBoxGrp -q -v1 colorShadedDisplayCheck`;
- optionVar -clearArray colorShadedDisplay;
- optionVar -intValue colorShadedDisplay $vals[0]
- -intValueAppend colorShadedDisplay $vals[1];
-
- $vals = `optionVar -q colorMaterialChannel`;
- $vals[$o] = `optionMenuGrp -q -sl colorMaterialPopup` -1;
- optionVar -clearArray colorMaterialChannel;
- optionVar -intValue colorMaterialChannel $vals[0]
- -intValueAppend colorMaterialChannel $vals[1];
-
-
- // Culling
- $vals=`optionVar -q displayPolyBackFaceCull`;
- $vals[$o]=`optionMenuGrp -q -sl backfaceCullPopup` - 1;
- optionVar -clearArray displayPolyBackFaceCull;
- optionVar -intValue displayPolyBackFaceCull $vals[0]
- -intValueAppend displayPolyBackFaceCull $vals[1];
-
- if ($doIt) polysDisplaySetup 0;
- }
-
- //
- // Procedure Name:
- // polysDisplaySetupOptions
- //
- // Description:
- // Construct the option box UI. Involves accessing the standard option
- // box and customizing the UI accordingly.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
- proc polysDisplaySetupOptions()
- {
- // Name of the command for this option box.
- //
- string $commandName = "polysDisplaySetup";
-
- // Build the option box actions.
- //
- string $callback = ($commandName + "Callback");
- string $setup = ($commandName + "Setup");
-
- // STEP 1: Get the option box.
- // ============================
- //
- // The value returned is the name of the layout to be used as
- // the parent for the option box UI.
- //
- string $layout = getOptionBox();
- setParent $layout;
-
- // STEP 2: Pass the command name to the option box.
- // =================================================
- //
- // Any default option box behaviour based on the command name is set
- // up with this call. For example, updating the 'Help' menu item with
- // the name of the command.
- //
- setOptionBoxTitle("Custom Polygon Display Options");
- setOptionBoxCommandName($commandName);
-
- // STEP 3: Activate the default UI template.
- // ==========================================
- //
- // Activate the default UI template so that the layout of this
- // option box is consistent with the layout of the rest of the
- // application.
- //
- setUITemplate -pushTemplate DefaultTemplate;
-
- // STEP 4: Create option box contents.
- // ===================================
- //
- // This, of course, will vary from option box to option box.
-
- // Turn on the wait cursor.
- //
- waitCursor -state 1;
-
- tabLayout -tabsVisible 0 -scrollable 1;
-
- string $parent = `columnLayout -adjustableColumn 1`;
-
- string $tmp = ("setParent " + $layout + "; "
- + "int $o=(`radioButtonGrp -q -sl polyObjsAffectedRadio` - 1); "
- + "if ($o >= 0) { optionVar -intValue displayPolyObjsAffected $o ; "
- + $setup + " " + $layout + " false; }");
-
- radioButtonGrp -numberOfRadioButtons 2
- -label "Objects Affected"
- -l1 "Selected" -l2 "All"
- -cc $tmp
- polyObjsAffectedRadio;
- separator;
-
- // vertices drawing style
- checkBoxGrp -numberOfCheckBoxes 3
- -label "Vertices"
- -l1 "Display"
- -l2 "Normals"
- -l3 "Backculling"
- polyVerticesDisplayCheck;
-
- separator;
- radioButtonGrp -numberOfRadioButtons 3
- -label "Edges"
- -l1 "Standard"
- -l2 "Soft/Hard"
- -l3 "Only Hard"
- polyEdgeDisplayRadio;
-
- checkBoxGrp -numberOfCheckBoxes 2
- -label "Highlight"
- -l1 "Border Edges"
- -l2 "Texture Borders"
- borderEdgeHiliteDisplayCheck;
-
- floatSliderGrp -label "Border Width"
- -min 1 -max 10 borderEdgeSizeSlider;
-
- separator;
-
- checkBoxGrp -numberOfCheckBoxes 4
- -label "Face" -l1 "Centers" -l2 "Normals" -l3 "Triangles" -l4 "Non-planar"
- polyFacetDisplayCheck;
-
- separator;
-
- checkBoxGrp -numberOfCheckBoxes 4
- -label "Show Item Numbers"
- -la4 "Vertices" "Edges" "Face" "UVs"
- polyItemDisplayCheck;
-
- floatSliderGrp -label "Normals Size" -min 0.02 -max 10 normalSizeSlider;
-
- // UV and UV topology display - BK
- checkBoxGrp -numberOfCheckBoxes 2
- -label "Texture Coordinates"
- -la2 "UV" "UV Topology"
- polyUVDisplayCheck;
-
- separator;
-
- // Colors
- checkBoxGrp -numberOfCheckBoxes 1
- -label "Color"
- -l1 "Color in Shaded Display"
- colorShadedDisplayCheck;
-
- optionMenuGrp -l "Color Material Channel" colorMaterialPopup;
- {
- menuItem -l "None" materialNoneMenuItem;
- menuItem -l "Ambient" materialAmbientMenuItem;
- menuItem -l "Ambient+Diffuse" materialAmbDiffMenuItem;
- menuItem -l "Diffuse" materialDiffuseMenuItem;
- menuItem -l "Specular" materialSpecularMenuItem;
- menuItem -l "Emission" materialEmissionMenuItem;
- setParent -m ..;
- }
-
- separator;
-
- optionMenuGrp -l "Backface Culling" -changeCommand ("polysDisplayUpdateCulling " + $parent) backfaceCullPopup;
- menuItem -l "Off" backfaceOffMenuItem;
- menuItem -l "On" backfaceOnMenuItem;
- menuItem -l "Keep Wire" backfaceWireMenuItem;
- menuItem -l "Keep Hard Edges" backfaceHardEdgeMenuItem;
- setParent -m ..;
-
- setParent ..;
- setParent ..;
-
- // Turn off the wait cursor.
- //
- waitCursor -state 0;
-
- // Step 5: Deactivate the default UI template.
- // ===========================================
- //
- setUITemplate -popTemplate;
-
- // Step 6: Customize the buttons.
- // ==============================
- //
- // Provide more descriptive labels for the buttons. This is not
- // necessary, but in some cases, for example, a button labelled
- // 'Create' may be more meaningful to the user than one labelled
- // 'Apply'.
- //
- // Disable those buttons that are not applicable to the option box.
- //
- // Attach actions to those buttons that are applicable to the option
- // box. Note that the 'Close' button has a default action attached
- // to it that will hide the window. If a a custom action is
- // attached to the 'Close' button then be sure to call the 'hide the
- // option box' procedure within the custom action so that the option
- // box is hidden properly.
-
- // 'Apply' button.
- //
- string $applyBtn = getOptionBoxApplyBtn();
- button -edit
- -command ($callback + " " + $parent + " " + 1)
- $applyBtn;
-
- // 'Save' button.
- //
- string $saveBtn = getOptionBoxSaveBtn();
- button -edit
- -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox")
- $saveBtn;
-
- // 'Reset' button.
- //
- string $resetBtn = getOptionBoxResetBtn();
- button -edit
- -command ($setup + " " + $parent + " " + 1)
- $resetBtn;
-
- // Step 7: Set the option box title.
- // =================================
- //
- setOptionBoxTitle("Custom Polygon Display Options");
-
- // Step 8: Customize the 'Help' menu item text.
- // ============================================
- //
- setOptionBoxHelpTag( "CustomPolygonDisplay" );
-
- // Step 9: Set the current values of the option box.
- // =================================================
- //
- eval (($setup + " " + $parent + " " + 0));
-
- // Step 10: Show the option box.
- // =============================
- //
- showOptionBox();
- }
-
-
- //
- // Procedure Name:
- // assembleCmd
- //
- // Description:
- // Construct the command that will apply the option box values.
- //
- // Input Arguments:
- // None.
- //
- proc string assembleCmd()
- {
- string $cmd = "";
-
- setOptionVars(false);
-
- int $o = `optionVar -q displayPolyObjsAffected`;
-
- int $polyEdgeDisp[3]=`optionVar -q displayPolyEdgeDisp`;
- float $polyBorderSize[3] =`optionVar -q displayPolyBorderEdgeSize`;
- int $polyBorderHilite[3] =`optionVar -q displayPolyBorderEdgeHilite`;
- int $polyVtxDisp[3]=`optionVar -q displayPolyVtxDisp`;
- int $polyVtxNormalsDisp[3]=`optionVar -q displayPolyVertexNormals`;
- int $polyFacetCntrDisp[3] = `optionVar -q displayPolyFacetCentreDisp`;
- int $polyFacetNrmlDisp[3] = `optionVar -q displayPolyFacetNormalDisp`;
- int $polyFacetTrnglDisp[3] = `optionVar -q displayPolyFacetTrngleDisp`;
- int $polyFacetWarpDisp[3] = `optionVar -q displayPolyFacetWarpDisp`;
- int $polyNumVertexDisp[3] = `optionVar -q displayPolyNumVertex`;
- int $polyNumEdgeDisp[3] = `optionVar -q displayPolyNumEdge`;
- int $polyNumFacetDisp[3] = `optionVar -q displayPolyNumFacet`;
- int $polyNumUvDisp[3] = `optionVar -q displayPolyNumUv`;
- float $polyNormalSize[3] = `optionVar -q displayPolyNormalSize`;
- int $polyUVDisp[3] = `optionVar -q displayPolyUV`;
- int $polyUVTopologyDisp[3] = `optionVar -q displayPolyUVTopology`;
- int $polyBackFaceCull[3] = `optionVar -q displayPolyBackFaceCull`;
- int $polyColorDisplay[3] = `optionVar -q colorShadedDisplay`;
- int $polyColorChannel[3] = `optionVar -q colorMaterialChannel`;
- int $polyVtxBackCull[3] = `optionVar -q displayPolyVtxBackCull`;
- int $bmh[3]=`optionVar -q displayPolyBorderMapHilite`;
-
- string $normalType="-facet";
- int $dispNormals=0;
- if ($polyVtxNormalsDisp[$o] != 0 || $polyFacetNrmlDisp[$o] != 0) {
- $dispNormals=1;
- if ($polyVtxNormalsDisp[$o] != 0) {
- if ($polyFacetNrmlDisp[$o] != 0)
- $normalType="-pointFacet";
- else $normalType="-point";
- } else $normalType="-facet";
- }
- string $affectType[] = {"-activeObjects", "-global", "-newPolymesh"};
- string $edgeType[] = {"-ae","-se","-he"};
- string $backFaceCull[] = {"-bc","-fb","-wbc","-hb"};
- string $facetHiliteType[] = {"full", "border", "center"};
-
- // Force uv display if uv topology display set on
- // Force uv topology display off if uv display is off
- if ($polyUVTopologyDisp[$o] != 0)
- {
- $polyUVDisp[$o] = true;
- }
- if ($polyUVDisp[$o] == 0)
- {
- $polyUVTopologyDisp[$o] = false;
- }
-
- // Color strings to convert channel # to string. Must
- // be the same as for polyOptions command !
- string $colorChannelStrings[] = {"none", "ambient", "ambientDiffuse",
- "diffuse", "specular", "emission"};
-
- $cmd = "polyOptions " + $affectType[$o] + " "
- + $edgeType[$polyEdgeDisp[$o]] + " "
- + " -sb " + $polyBorderSize[$o] + " "
- + " -db " + $polyBorderHilite[$o] + " "
- + " -dmb " + $bmh[$o] + " "
- + " -dv " + $polyVtxDisp[$o] + " "
- + " -dn " + $dispNormals + " " + $normalType + " "
- + " -dc " + $polyFacetCntrDisp[$o] + " "
- + " -dt " + $polyFacetTrnglDisp[$o] + " "
- + " -dw " + $polyFacetWarpDisp[$o] + " "
- + " -din " + $polyNumVertexDisp[$o] + " "+ $polyNumEdgeDisp[$o] + " "+ $polyNumFacetDisp[$o] + " "+ $polyNumUvDisp[$o] + " "
- + " -sn " + $polyNormalSize[$o] + " "
- + $backFaceCull[$polyBackFaceCull[$o]] + " "
- + " -duv " + $polyUVDisp[$o] + " "
- + " -uvt " + $polyUVTopologyDisp[$o] + " "
- + " -cs " + $polyColorDisplay[$o] + " "
- + " -cm " + $colorChannelStrings[$polyColorChannel[$o]] + " "
- + " -bcv " + $polyVtxBackCull[$o] + ";";
-
- return $cmd;
- }
-
- //
- // Procedure Name:
- // polysDisplaySetup
- //
- // Description:
- // Perform the optionBoxExample1 command using the corresponding
- // option values. This procedure will also show the option box
- // window if necessary as well as construct the command string
- // that will invoke the optionBoxExample1 command with the current
- // option box values.
- //
- // Input Arguments:
- // 0 - Execute the command.
- // 1 - Show the option box dialog.
- // 2 - Return the command.
- //
- global proc string polysDisplaySetup(int $action)
- {
- string $cmd = "";
-
- switch ($action) {
-
- // Execute the command.
- //
- case 0:
- // Get the command.
- //
- $cmd = `assembleCmd`;
-
- // Execute the command with the option settings.
- //
- eval($cmd);
-
- break;
-
- // Show the option box.
- //
- case 1:
- polysDisplaySetupOptions;
- break;
-
- // Return the command string.
- //
- case 2:
- // Get the command.
- //
- $cmd = `assembleCmd`;
- break;
- }
- return $cmd;
- }
-
-
-
-
-
-
-
-